package com.shangxia.dreaming.common.util.excelUtil;

import com.alibaba.excel.EasyExcel;
import com.shangxia.dreaming.common.content.FileContentEnum;
import com.shangxia.dreaming.common.util.excelUtil.listener.NoModelDataListener;
import lombok.extern.slf4j.Slf4j;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import static com.shangxia.dreaming.common.content.ConditionContent.*;

/**
 * @ProjectName: dreaming
 * @ClassName: ReadExcelUtil
 * @Time: 2020/10/5
 * @Author: zhouy
 * @Description:
 * @Experience:
 */

@Slf4j
public class ReadExcelUtil {
    public static List<List<String>> readExcelResult(String fileName, Integer headLength) {
        File file = new File(PATH_Result + fileName + FileContentEnum.EXCEL_END);
        if (!file.exists()) {
            return new ArrayList<>();
        }
        EasyExcel.read(file, new NoModelDataListener()).sheet().headRowNumber(headLength).doRead();
        return NoModelDataListener.ALL_RESULT;
    }
}
